<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>固定定位</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <style>
        body{
            height:3000px;
            background: blue;
        }
    .fix{
        width:100px;
        height:100px;
        background: red;
        position:fixed;
        right:0;
        bottom:0;
        
    }
    
    </style>
</head>
<body>
    <div class="fix">

    </div>
    <script>
    $('.fix').click(function(){
        $("html,body").animate({scrollTop:"0px"})
    })
    </script>
</body>
</html>